<h1 id="stata-tidy"><a href="#stata-tidy" class="headerlink" title="stata-tidy"></a>stata-tidy</h1><p>This is a basic implementation of the  <a href="https://github.com/hadley/tidyr">tidyr package</a> from R.</p>
<h2 id="gather"><a href="#gather" class="headerlink" title="gather"></a>gather</h2><p>gather transforms a wide dataset into a long dataset (i.e. reshape long). The command takes a list of variables as argument. This list corresponds to variables to gather.</p>
<p>Use the option  <code>label</code>  to save the variable labels as a new variable</p>
<p><img src="img/gather.jpg" alt=""></p>
<h2 id="spread"><a href="#spread" class="headerlink" title="spread"></a>spread</h2><p>spread transforms a long dataset into a wide dataset (i.e. reshape wide). The command takes two variable names as argument. The first variable contains the new variable names. The second variable contains the new variable values.</p>
<p><img src="img/spread.jpg" alt=""></p>
<h2 id="Installation"><a href="#Installation" class="headerlink" title="Installation"></a>Installation</h2><pre><code>net install tidy, from(https://github.com/matthieugomez/tidy.ado/raw/master/)</code></pre><p>If you have a version of Stata &lt; 13, you need to install it manually:</p>
<ol>
<li>Click the “Download ZIP” button in the right column to download a zipfile. Extract it into a folder (e.g. ~/SOMEFOLDER)</li>
<li>Run: (changing SOMEFOLDER with whatever you picked)<pre><code>cap ado uninstall tidy
net install tidy, from(&quot;~/SOMEFOLDER&quot;)</code></pre></li>
</ol>
